package com.example.yls.demoa;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by yls on 2018/11/6.
 */

public class MyReceiver extends BroadcastReceiver {
    private IOnUpdateListener listener;
    private static final String TAG = "MyReceiver";

    /*public MyReceiver(IOnUpdateListener listener)
    {
        this.listener = listener;
    }
*/
    @Override
    public void onReceive(Context context, Intent intent) {
    /*    String action =intent.getAction();*/
       /* listener.UpdateTime();*/
            String action=intent.getAction();
       if (action.equals("weather")){
                String weather=intent.getStringExtra("WEATHER");
                int wendu=intent.getIntExtra("WENDU",0);

           Log.e(TAG, "onReceive:weather:"+weather+"    wendu:"+wendu);
                  }
                  else if (action.equals("traffic")){
           String traffic=intent.getStringExtra("TRAFFIC");
           int time=intent.getIntExtra("TIME",0);

           Log.e(TAG, "onReceive:weather:"+traffic+"    time:"+time);
       }
    }

}
